﻿using eslib.NetUpdator;
using System.IO.Compression;
using System.Reflection.Metadata.Ecma335;

namespace test
{
    internal class Program
    {
        static void Main(string[] args)
        {
            _ = Update();
            Console.ReadKey(true);
        }

        private static async Task Update()
        {
            string configUrl = $"https://gitee.com/eslib/yixing_qimen_config/raw/master/yixing_localserver_updator_config.json";
            OnlineUpdator updator = new(configUrl);

            if (!updator.NeedUpdate())
            {
                echo("不需要更新，巳经是最新版本");
                return;
            }

            bool success = await updator.Update(echo);
            if (success)
            {
                echo("更新全部完成");
            }
        }


        static void echo(string msg)
        {
            Console.WriteLine(msg);
        }
    }
}
